<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="@{/}">
<meta charset="UTF-8">
<title>QuickDemo模板</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/x-icon" href="static/img/logo.ico" />
<link rel="stylesheet" href="static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="static/plugin/x-admin/css/font.css">
<link rel="stylesheet" href="static/plugin/x-admin/css/xadmin.css">
<script type="text/javascript" src="static/layui/layui.all.js"></script>
<script type="text/javascript" src="static/jsencrypt/jsencrypt.min.js"></script>
<script type="text/javascript" src="static/plugin/jquery/jquery-3.2.1.min.js"></script>
<style type="text/css">
	.logoDiv{
		position:absolute;
		min-height: 250px;
    	max-width: 250px;
    	z-index:9999;
    	left: 50px;
    	top: 20px;
	}
</style>
</head>
<body class="login-bg">
	<div class="login">
		<div class="message">QuickDemo模板</div>
		<div id="darkbannerwrap"></div>

		<form method="post" action="login" class="layui-form">
			<input name="username" placeholder="用户名" autocomplete="off"
				type="text" lay-verify="username" class="layui-input">
			<hr class="hr15">
			<input id="password" lay-verify="password" placeholder="密码"
				autocomplete="off" type="password" class="layui-input">
			<input type="hidden" name="password">
			<hr class="hr15">
			<div class="layui-inline">
				<label class="layui-form-label"
					style="width: 40px; padding: 9px 0px;">验证码&nbsp;</label>
				<div class="layui-input-inline">
					<input type="text" name="code" style="width: 150px; height: 35px;"
						autocomplete="off" lay-verify="code" class="layui-input">
				</div>
				<div class="layui-input-inline">
					<img src="" id="code">
				</div>

			</div>
			<div class="layui-form-item">
				<input type="checkbox" name="rememberMe" title="记住我" lay-skin="primary">
		    </div>
			<hr class="hr15">
			<input value="登录" lay-submit lay-filter="login" style="width: 100%;"
				type="submit">
			<hr class="hr20">
		</form>
	</div>

	<script th:inline="javascript">
		var jsencrypt = new JSEncrypt();
		  	jsencrypt.setPublicKey([[${session.publicKey}]]);
		  	$("#password").bind("input porpertychange focus",function(){
		   	var password = $(this).val();
		   	var encryptPwd = jsencrypt.encrypt(password);
		   	$("input[name = 'password']").val(encryptPwd);
	  	})
		var layer,laytpl;
		$(function() {
			layui.use([ 'form', 'layer','laytpl' ], function() {
				var form = layui.form,
				laytpl = layui.laytpl;
				form.verify({
					username : function(v) {
						if (v.trim() == '') {
							return "用户名不能为空";
						}
					},
					password : function(v) {
						if (v.trim() == '') {
							return "密码不能为空";
						}
					},
					code : function(v) {
						if (v.trim() == '') {
							return '验证码不能为空';
						}
					}
				});

				form.render();
			});
			layer = layui.layer;
			var msg = [[${message}]];
			if (msg) {
				layer.msg(msg, {
					icon : 5,
					anim : 6,
				});
			}
			$("#code").click(function() {
				var url = "reFreshRandomCode?" + new Date().getTime();
				this.src = url;
			}).click().show();
			$('#code').on('mouseover', function() {
				layer.tips('点击刷新验证码', this, {
					time : 1000
				});
			});
		})

		if (window != top)
			top.location.href = location.href;
		
		/* var data = { //数据
		  "title":"Layui常用模块"
		  ,"list":[{"modname":"弹层","alias":"layer","site":"layer.layui.com"},{"modname":"表单","alias":"form"}]
		}
		var ss = "<h3>{{ d.title }}</h3>"+
  		"<ul>"+
			"{{#  layui.each(d.list, function(index, item){ }}"+
		"<li>"+
  			"<span>{{ item.modname }}</span>"+
  			"<span>{{ item.alias }}：</span>"+
  			"<span>{{ item.site || '' }}</span>"+
		"</li>"+
			"{{#  }); }}"+
			"{{#  if(d.list.length === 0){ }}"+
			"无数据"+
			"{{#  } }}"+
		"</ul>"
		var view = document.getElementById('view');
		layui.laytpl(ss).render(data, function(html){
			console.log(html);
		  view.innerHTML = html;
		}); */
	</script>

	<!-- 底部结束 -->
</body>
</html>
